import 'dart:ui';

import 'package:flutter/material.dart';

class FrostedGlass extends StatelessWidget {

  final double width;
  final double height;
  final Color? color;
  final BorderRadius borderRadius;
  final double sigmaX;
  final double sigmaY;
  final Widget child;

  const FrostedGlass({
    super.key,
    required this.width,
    required this.height,
    required this.color,
    required this.borderRadius,
    required this.sigmaX,
    required this.sigmaY,
    required this.child,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      alignment: Alignment.center,
      width: width,
      height: height,
      decoration: BoxDecoration(
        color: color,
        borderRadius: borderRadius,
      ),
      child: ClipRRect(
        child: BackdropFilter(
          filter: ImageFilter.blur(sigmaX: sigmaX, sigmaY: sigmaY),
          child: child
        ),
      ),
    );
  }
}
